home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
026-050
/
scopedisk46
/
mj-pgs
/
j-size.asc
< prev
next >
Wrap
Text File
|
1995-03-18
|
4KB
|
86 lines
push a7 save all registers
lea -106(pc),a5 pointer to variables
move.l 396(a5),d0 holds re
move.l 400(a5),d4 holds im
movea.l #0,a0 initialize counter
movea.l 4(a5),a1 holds cr
movea.l 8(a5),a2 holds ci
bra Start
L180 addq.w #1,a0 increment counter
sub.l a6,d7 re2-im2
add.l a1,d7 re2-im2+cr
moveq #0,d3 initialize flag
move.l d0,16(a5) tempstow re
bpl Plus1
moveq #1,d3 found one negative number
neg.l 16(a5)
Plus1 move.l d4,20(a5) tempstow im
bpl Plus2
addq.l #1,d3 found another negative number
neg.l 20(a5)
Plus2 move.w 16(a5),d1 multiply 2*re*im routine
mulu 22(a5),d1 including dividing by 2^28
move.w 18(a5),d2 and left shift for 2*
mulu 20(a5),d2
add.l d2,d1
moveq #11,d6
lsr.l d6,d1
move.w 18(a5),d2
mulu 22(a5),d2
moveq #27,d6
lsr.l d6,d2
add.l d2,d1
move.w 16(a5),d2
mulu 20(a5),d2
lsl.l #5,d2
add.l d2,d1
cmpi.b #1,d3 if exactly one negative number
bne Plus3 then answer is negative
neg.l d1
Plus3 add.l a2,d1
move.l d1,d4 im=2*re*im+ci
move.l d7,d0 re=tempstow
Start moveq #0,d3 flag for re2 or im2 too big
move.l d0,16(a5) set up square routine
bsr Square
tst.b d3
bne Out re2 exceeds limit
move.l d1,d7 tempstow re2
move.l d4,16(a5) set up square routine
bsr Square
tst.b d3
bne Out im2 exceeds limits
move.l d1,a6 store im2
add.l d7,d1 re2+im2
cmpa.l (a5),a0
beq Out1 equals max iterations
cmp.l #1073741824,d1
bmi.w L180 distance still less than 2
Out move.l a0,12(a5) move count to variable para(3)
pop a7 unsave registers
rts return to BASIC
Square bpl Plus4
neg.l 16(a5)
Plus4 move.w 18(a5),d1 square routine using formula
mulu 18(a5),d1 (a+b)^2=a^2+2ab+b^2
moveq #28,d6
lsr.l d6,d1
move.w 16(a5),d2
mulu 18(a5),d2
moveq #11,d6
lsr.l d6,d2
add.l d2,d1
move.w 16(a5),d2
mulu 16(a5),d2
cmp.l #67108864,d2
spl d3 set flag if square exceeds limit
lsl.l #4,d2
add.l d2,d1
rts
Out1 cmp.l #1073741824,d1
bge Out
move.l 392(a5),d3
lsr.l d3,d1 divide re^2+im^2 by 2^para(98)
adda.l d1,a0 add count and scaled size
bra Out